/*
	File: E:/3D/games/mgt/svn_panzer_2010/data/scripts/jump_to_level.nut
	Author: Astrofra
*/

/*!
	@short	JumpToLevel
	@author	Astrofra
*/
class	JumpToLevel
{
/*<
	<Parameter =
		<target_level = <Name = "Target Level"> <Type = "String"> <Default = "level_1_0">>
		<target_spawn = <Name = "Target Spawn Point"> <Type = "String"> <Default = "spawn_0">>
	>
>*/
	/*!
		@short	OnUpdate
		Called during the scene update, each frame.
	*/

	target_level	=	0
	target_spawn	=	0

	project_script	=	0

	function	OnUpdate(item)
	{
		local	trigger_item = ItemCastToTrigger(item)
		if (TriggerTestItem(trigger_item, project_script.screen_script.player_item))
		{
			print("JumpToLevel::OnItemEnter(" + ItemGetName(item) + ")")
			print("JumpToLevel::OnItemEnter() : target_level = " + target_level + ", target_spawn = " + target_spawn)
		
			project_script.screen_name = target_level
			project_script.spawn_name = target_spawn
			project_script.screen_script.status = "next_level"
		}
			
	}

	/*!
		@short	OnSetup
		Called when the item is about to be setup.
	*/
	function	OnSetup(item)
	{
		print("JumpToLevel::OnSetup(" + ItemGetName(item) + ")")
		project_script = ProjectGetScriptInstance(g_project)
	}

	function	OnItemEnter(trigger_item, item)
	{
		print("JumpToLevel::OnItemEnter(" + ItemGetName(trigger_item) + "," + ItemGetName(item) + ")")
		print("JumpToLevel::OnItemEnter() : target_level = " + target_level + ", target_spawn = " + target_spawn)
		
		project_script.screen_name = target_level
		project_script.spawn_name = target_spawn
		project_script.screen_script.status = "next_level"
	}
}
